package com.lc.afbx.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.R;

/**
 * Created by Administrator on 2016/7/22.
 */
public abstract class MyAlertDialog extends BaseDialog {

    public MyAlertDialog(Context context, String message) {

        super(context);

        setContentView(R.layout.dialog_alert_my);

        BaseApplication.ScaleScreenHelper.loadView((ViewGroup) findViewById(R.id.dialog));

        ((TextView) findViewById(R.id.alert_message)).setText(message);

        View.OnClickListener listener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.alert_confirm:

                        onConfirm();

                        break;

                }

                dismiss();

            }

        };


        findViewById(R.id.alert_confirm).setOnClickListener(listener);


    }

    public MyAlertDialog(Context context, String message, String bottomStr) {

        super(context);

        setContentView(R.layout.dialog_alert_my);

        BaseApplication.ScaleScreenHelper.loadView((ViewGroup) findViewById(R.id.dialog));

        ((TextView) findViewById(R.id.alert_message)).setText(message);
        ((TextView) findViewById(R.id.alert_confirm)).setText(bottomStr);

        View.OnClickListener listener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.alert_confirm:

                        onConfirm();

                        break;

                }

                dismiss();

            }

        };


        findViewById(R.id.alert_confirm).setOnClickListener(listener);


    }

    protected abstract void onConfirm();

}
